import GlobalParam
import LogUtil


class SimpleWSManager:

    def disparcher(self, instrument, msg):
        for ws in GlobalParam.wss:
            if ws.label is not None and instrument in ws.label:
                ws.sendMessage(msg)

    def broadcast(self, msg):
        try:
            for ws in GlobalParam.wss:
                ws.sendMessage(msg)
        except Exception as e:
            LogUtil.red_printLog(e.__str__())
